#include "StdAfx.h"
#include "XTCPClientIOCPRobot.h"

IMPLEMENT_DYNCREATE(XTCPClientIOCPRobot) 
XTCPClientIOCPRobot::XTCPClientIOCPRobot(void)
{
	objName = "XTCPClientIOCPRobot";
	//m_lpszClassName = "ConfigureRebot";
	objType = E_OBJECT_TYPE::XOBJECT;
	mpServer = NULL;
}


XTCPClientIOCPRobot::~XTCPClientIOCPRobot(void)
{
	delete mpServer;
}


unsigned int XTCPClientIOCPRobot::Init(const char * host, int port, string& serverType)
{
		
	m_lock.Lock();
	mpServer = new CIocp;	
	mpServer->InitIOPort();	
	mpServer->iIocpType = 1;
	printf("XTCPClientIOCPRobot: start...\" %s\" :%d :%s \n", host, port, serverType.c_str());
	m_lock.UnLock();
	return 0;
}

bool XTCPClientIOCPRobot::ClientJoinIOCP(ClientRobot* pRobot)
{
	m_lock.Lock();
	mpServer->JoinClientIocp(pRobot);
	m_lock.UnLock();
	return true;
}